<include file="Public:head" />
<style>

    .table-striped tr  .td_dan{
        line-height: 30px;text-align: right;width: 50px
    }
    .width20{
        width: 260px;
    }
</style>
<body class="overflow-hidden">
<div class="wrapper preload">
    <include file="Public:header" />
    <include file="Public:left" />
    <div class="main-container">
        <div class="padding-md">
            <div class="row">
                <div class="col-sm-12">
                    <div class="page-title">
                       {$info['id']?'修改':'新增'}机构
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="smart-widget widget-green">
                        <form action="__SELF__" method="post" class="form-horizontal form_admin7">
                            <table class="table table-striped no-margin">
                                <tr>
                                    <td class="td_dan" >机构名称  <span style="color: red">*</span></td>
                                    <td width="20%" style="text-align: left;">
                                        <select name="fid" id="fid"class="form-control width20">
                                            <if condition="$info['id']">
                                                    <option value="{$info.fid}" selected>{$info.fid|getAgencynameById}</option>
                                            <else />
                                                <option value="">请选择机构</option>
                                                <volist name="list" id="vo">
                                                    <option value="{$vo.id}">{$vo['name']}</option>
                                                </volist>
                                             </if>
                                        </select>
                                    </td>
                                    <td class="td_dan">城市 <span style="color: red">*</span></td>
                                    <td width="40%"  style="text-align: left;">
                                        <select class="form-control width20" name="city" style="width: 260px;padding: 5px;">
                                            <volist name=":jiangSu()" id="vo">
                                                <eq name="key" value="$info.city">
                                                    <option value="{$key}" selected="selected">{$vo}</option>
                                                    <else/>
                                                    <option value="{$key}">{$vo}</option>
                                                </eq>
                                            </volist>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_dan" >链接地址  <span style="color: red"></span></td>
                                    <td width="20%" style="text-align: left;">
                                        <input type="text" name="url" value="{$info.url}" class="form-control width20">
                                    </td>
                                    <td class="td_dan">图片 <span style="color: red"></span></td>
                                    <td width="40%"  style="text-align: left;">
                                        <input type='button' class='form-control 'style="width: 100px;display:inline-block;" value='选择文件'  />
                                        <empty name="info['id']">
                                            <input type="file"  onchange="ajaxFileUpload('icoA',1);"  id="icoA" name="icoA" class="file_1" style="width: 100px;height: 34px;opacity: 0;position: relative;top: -34px;">
                                            <else />
                                            <input type="file"  onchange="ajaxFileUpload('icoA',1,1,1)"  id="icoA" name="icoA" class="file_1" style="width: 100px;height: 34px;opacity: 0;position: relative;top: -34px;">
                                        </empty>
                                        <div class="main_chaxin_1_2-8">
                                            <span class="span1" style="color:red;font-size: 12px;"> (目前只支持后缀名为 jpg , png , jpeg , bmp 格式)</span>
                                            <div id="show_upload_message_icoA" class="span1">
                                                <foreach name="upload_ids_arr" item="vo" >
                                                    <if condition="$vo neq ''">
                                                        <div id="file_id_{$vo}">
                                                            <a style="color:blue;" target="_blank" href="{:U('JiangSu/down_file')}?file_id={$vo}">查看图片</a>
                                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                                            <a style="color:blue;" href="javascript:del_file('{$vo}','icoA')">删除</a>
                                                        </div>
                                                    </if>
                                                </foreach>
                                            </div>

                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_dan" style="line-height: 22px;">机构简介 <span style="color: red"></span></td>
                                    <td width="40%"  style="text-align: left;" colspan="3">
                                        <label>
                                            <textarea  name="content" class="form-control " style="width: 500px;height: 200px;;">{$info['content']}</textarea>
                                        </label>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4"  >
                                        <input name="id"  type="hidden" value="{$info.id}">
                                        <input type="hidden" name="img" id="upload_icoA" value="{$info.img}" class="file_1"/>
                                        <button type="submit" class="action-button ajax-post" style="margin-left: 40%" target-form="form_admin7">保存</button>
                                        <button type="button" class="action-button " onclick="window.open('{:U("JiangSu/index")}','_self')">返回</button>
                                    </td>
                                </tr>

                            </table>
                        </form>
                    </div><!-- ./smart-widget -->
                </div><!-- ./col -->
            </div><!-- ./row -->
        </div><!-- ./padding-md -->
    </div><!-- /main-container -->
    <include file="Public:foot" />
</div><!-- /wrapper -->
<!--<include file="Public/base_fc" />-->
<a href="#" class="scroll-to-top hidden-print"><i class="fa fa-chevron-up fa-lg"></i></a>
</body>
</html>
<block name="script">
    <script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
    <script>
        $(function(){
            highlight_nav2('{:U("jiangSu/index")}');

        })
        Think.setValue("typeid",{$info.typeid|default =1});
        <present name="info.id">
                Think.setValue("categoryid[]", {$info.categoryid|json_encode}||[0]);
        Think.setValue("typeId",{$info.typeid|default =1});
        </present>
        $(document).ready(function(){
            var obj_check = $('input[name="typeid"]:checked').val();
            if(obj_check==2){
                $(".unit").show();
                $('#categoryId').hide();
            }else if(obj_check==1){
                $('.unit').hide();
            }
        });
        $('input[name="typeid"]').change(function(){
            var typeId = $('input[name="typeid"]:checked').val();
            if(typeId==1){
                $('.unit').hide();
                $('#categoryId').show();
            }else if(typeId==2){
                $(".unit").show();
                $('#categoryId').hide();
            }
        });
    </script>
</block>
